package com.tuling.api.properties;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
* Created by wuwc on 2017/9/8.
*/
//@Configuration
//@Scope("singleton")

//@ConfigurationProperties(locations="classpath:config/user.properties", prefix="com.chhliu.springboot")
@Component
@PropertySource(value = "classpath:properties/database.properties")
public class DBProperties {
        private String url;
        private String username;
        private String password;
        private String driverClassName;
        private Integer initialSize;
        private Integer minIdle;
        private Integer maxActive;
        private Integer maxWait;
        private String validationQuery;
        private String filters;
        private Long timeBetweenEvictionRunsMillis;
        private Long minEvictableIdleTimeMillis;
        private boolean testOnBorrow;
        private boolean testOnReturn;
        private String allowIp;
        private String loginName;
        private String loginPassword;
        private String resetEnable;
        public String getUrl() {
            return url;
        }
        @Value("${datasource.url}")
        public void setUrl(String url) {
            this.url = url;
        }
        public String getUsername() {
            return username;
        }
        @Value("${datasource.username}")
        public void setUsername(String username) {
            this.username = username;
        }
        public String getPassword() {
            return password;
        }
        @Value("${datasource.password}")
        public void setPassword(String password) {
            this.password = password;
        }
        public String getDriverClassName() {
            return driverClassName;
        }
        @Value("${datasource.driverClassName}")
        public void setDriverClassName(String driverClassName) {
            this.driverClassName = driverClassName;
        }
        public Integer getInitialSize() {
            return initialSize;
        }
        @Value("${datasource.initialSize}")
        public void setInitialSize(Integer initialSize) {
            this.initialSize = initialSize;
        }
        public Integer getMinIdle() {
            return minIdle;
        }
        @Value("${datasource.minIdle}")
        public void setMinIdle(Integer minIdle) {
            this.minIdle = minIdle;
        }
        public Integer getMaxActive() {
            return maxActive;
        }
        @Value("${datasource.maxActive}")
        public void setMaxActive(Integer maxActive) {
            this.maxActive = maxActive;
        }
        public Integer getMaxWait() {
            return maxWait;
        }
        @Value("${datasource.maxWait}")
        public void setMaxWait(Integer maxWait) {
            this.maxWait = maxWait;
        }
        public String getValidationQuery() {
            return validationQuery;
        }
        @Value("${datasource.validationQuery}")
        public void setValidationQuery(String validationQuery) {
            this.validationQuery = validationQuery;
        }
        public String getFilters() {
            return filters;
        }
        @Value("${datasource.filters}")
        public void setFilters(String filters) {
            this.filters = filters;
        }
        public Long getTimeBetweenEvictionRunsMillis() {
            return timeBetweenEvictionRunsMillis;
        }
        @Value("${datasource.timeBetweenEvictionRunsMillis}")
        public void setTimeBetweenEvictionRunsMillis(Long timeBetweenEvictionRunsMillis) {
            this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
        }
        public Long getMinEvictableIdleTimeMillis() {
            return minEvictableIdleTimeMillis;
        }
        @Value("${datasource.minEvictableIdleTimeMillis}")
        public void setMinEvictableIdleTimeMillis(Long minEvictableIdleTimeMillis) {
            this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
        }
        public boolean getTestOnBorrow() {
            return testOnBorrow;
        }
        @Value("${datasource.testOnBorrow}")
        public void setTestOnBorrow(boolean testOnBorrow) {
            this.testOnBorrow = testOnBorrow;
        }
        public boolean getTestOnReturn() {
            return testOnReturn;
        }
        @Value("${datasource.testOnReturn}")
        public void setTestOnReturn(boolean testOnReturn) {
            this.testOnReturn = testOnReturn;
        }
        public String getAllowIp() {
            return allowIp;
        }
        @Value("${druid.allowIp}")
        public void setAllowIp(String allowIp) {
            this.allowIp = allowIp;
        }
        public String getLoginName() {
            return loginName;
        }
        @Value("${druid.loginName}")
        public void setLoginName(String loginName) {
            this.loginName = loginName;
        }
        public String getLoginPassword() {
            return loginPassword;
        }
        @Value("${druid.loginPassword}")
        public void setLoginPassword(String loginPassword) {
            this.loginPassword = loginPassword;
        }
        public String getResetEnable() {
            return resetEnable;
        }
        @Value("${druid.resetEnable}")
        public void setResetEnable(String resetEnable) {
            this.resetEnable = resetEnable;
        }
}

